
<div class="modal-body pageContent">
    <div class="row">
          <div class="col-lg-12 col-lg-offset-2">
              <form id="processDetailsAdd" method="post" class="form-horizontal" action="/process/addProcessParameter">
                <input type="hidden" name="schemeId" value="{{processSchemeId}}">
                  <div class="form-group">
                      <label class="col-lg-12 control-label"><span class="indicator">*</span><span class="indicatorName">工序名称</span></label>
                      <div class="col-lg-12">
                          <input type="text" class="form-control" name="processName"  />
                      </div>
                  </div>
                  <div class="form-group">
                      <label class="col-lg-12 control-label">附件</label>
                      <div class="col-lg-12">
                          <input type="file" name="parameterFile" />
                      </div>
                  </div>
              </form>
          </div>
      </div>
  </div>
  <div class="modal-footer pageFooter">
     <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
     <button  class="btn btn-primary"  type="submit">保存</button>
  </div>
<script type="text/javascript">
$(document).ready(function() {  
   $('.selectpicker').selectpicker();//初始化
   $('#processDetailsAdd')
        .bootstrapValidator({
            message: '此值无效',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
              processName: {
                    validators: {
                        notEmpty: {
                            message: '请填写工序名称'
                        },
                    }
                }
            }
        })
        .on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();
            var $form = $(e.target);
            var bv = $form.data('bootstrapValidator');
            //console.log($form.serialize());
            // Use Ajax to submit form data
         var formData = new FormData($("#processDetailsAdd")[0]);  
             $.ajax({  
                  url: '/process/addProcessParameter' ,  
                  type: 'POST',  
                  data: formData,  
                  async: true,  
                  cache: false,  
                  contentType: false,  
                  processData: false,   
                  success: function (returndata) { 
                    if(returndata.length===9371){   //session超时返回的登录页面 避免接口返回的也是字符串不是json
                                location.href="/severError";
                    }else{  //正常处理
                        if(JSON.parse(returndata).statusCode==200){
                            toastr.success(JSON.parse(returndata).message+'!');
                            $('#myModal').modal('hide');
                            $("#ProcessDetailTable").bootstrapTable('refresh');
                        }else{
                            toastr.warning(JSON.parse(returndata).message+'!');
                        }
                    }
                  },  
                  error: function (returndata) {  
                    if(result.status===503||result.status===500){
                        toastr.error(JSON.parse(returndata).message+'!');
                        // $('#myModal').modal('hide');
                        // $("#ProcessDetailTable").bootstrapTable('refresh');
                    }
                  }  
             });  
        });
});

</script>
